/**
 * 
 */
package ua.ws.feedsreader.actions;

import java.util.List;
import java.util.Map;

import ua.ws.feedsreader.common.User;
import ua.ws.feedsreader.db.SemanticManager;
import ua.ws.feedsreader.utils.Log;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author ricardo
 *
 */
public class CategorieSuggestion extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1519226460495636117L;

	
	private String keyword;
	private List<String> categoriesSuggestion;
	
	
	@Override
	public String execute() throws Exception {
		
		Map<String, Object> session = ActionContext.getContext().getSession();
		Log.debug("CategorieSugestion");
		User user = (User) session.get("USER");
		Log.debug("CategorieSugestion - User:"+user.getLogin() +" keyword="+ keyword );
		SemanticManager semanticManager = new SemanticManager();
		categoriesSuggestion = semanticManager.getCategoriesSugestion(keyword, user.getLogin());
		
		return SUCCESS;
	}


	/**
	 * @return the categoriesSugestion
	 */
	public List<String> getCategoriesSuggestion() {
		return categoriesSuggestion;
	}


	/**
	 * @param categoriesSugestion the categoriesSugestion to set
	 */
	public void setCategoriesSuggestion(List<String> categoriesSuggestion) {
		this.categoriesSuggestion = categoriesSuggestion;
	}


	/**
	 * @return the keyword
	 */
	public String getKeyword() {
		return keyword;
	}


	/**
	 * @param keyword the keyword to set
	 */
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
}
